From 982890515da6d0b309a4f4b463c78b7b8cfebca2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Wed, 27 Nov 2019 16:56:47 +0100 Subject: [PATCH] gl renderer: Don't use g_assert() for code that should always run g_assert can be compiled out. --- gsk/gl/gskglrenderer.c | 98 +++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 44 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 94f72a8578..326c6b586e 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1283,10 +1283,12 @@ render_rounded_clip_node (GskGLRenderer *self, } ops_push_clip (builder, &child_clip); - g_assert (add_offscreen_ops (self, builder, &node->bounds, - child, - ®ion, &is_offscreen, - FORCE_OFFSCREEN | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, &node->bounds, + child, + ®ion, &is_offscreen, + FORCE_OFFSCREEN | RESET_OPACITY)) + g_assert_not_reached (); + ops_pop_clip (builder); ops_set_program (builder, &self->blit_program); @@ -1321,11 +1323,12 @@ render_color_matrix_node (GskGLRenderer *self, if (node_is_invisible (child)) return; - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - child, - ®ion, &is_offscreen, - RESET_CLIP | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, + &node->bounds, + child, + ®ion, &is_offscreen, + RESET_CLIP | RESET_OPACITY)) + g_assert_not_reached (); ops_set_program (builder, &self->color_matrix_program); ops_set_color_matrix (builder, @@ -1390,11 +1393,12 @@ render_blur_node (GskGLRenderer *self, * (see gsk_blur_node_new), but we didn't have to do that if the blur * shader could handle that situation. */ - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - child, - ®ion, &is_offscreen, - RESET_CLIP | FORCE_OFFSCREEN | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, + &node->bounds, + child, + ®ion, &is_offscreen, + RESET_CLIP | FORCE_OFFSCREEN | RESET_OPACITY)) + g_assert_not_reached (); ops_set_program (builder, &self->blur_program); @@ -1909,10 +1913,11 @@ render_shadow_node (GskGLRenderer *self, continue; /* Draw the child offscreen, without the offset. */ - g_assert (add_offscreen_ops (self, builder, - &shadow_child->bounds, - shadow_child, ®ion, &is_offscreen, - RESET_CLIP | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, + &shadow_child->bounds, + shadow_child, ®ion, &is_offscreen, + RESET_CLIP | RESET_OPACITY)) + g_assert_not_reached (); ops_set_program (builder, &self->coloring_program); ops_set_color (builder, &shadow->color); @@ -1970,17 +1975,19 @@ render_cross_fade_node (GskGLRenderer *self, /* TODO: We create 2 textures here as big as the cross-fade node, but both the * start and the end node might be a lot smaller than that. */ - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - start_node, - &start_region, &is_offscreen1, - FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, + &node->bounds, + start_node, + &start_region, &is_offscreen1, + FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY)) + g_assert_not_reached (); - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - end_node, - &end_region, &is_offscreen2, - FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY)); + if (!add_offscreen_ops (self, builder, + &node->bounds, + end_node, + &end_region, &is_offscreen2, + FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY)) + g_assert_not_reached (); ops_set_program (builder, &self->cross_fade_program); @@ -2010,17 +2017,19 @@ render_blend_node (GskGLRenderer *self, /* TODO: We create 2 textures here as big as the blend node, but both the * start and the end node might be a lot smaller than that. */ - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - bottom_child, - &bottom_region, &is_offscreen1, - FORCE_OFFSCREEN | RESET_CLIP)); - - g_assert (add_offscreen_ops (self, builder, - &node->bounds, - top_child, - &top_region, &is_offscreen2, - FORCE_OFFSCREEN | RESET_CLIP)); + if (!add_offscreen_ops (self, builder, + &node->bounds, + bottom_child, + &bottom_region, &is_offscreen1, + FORCE_OFFSCREEN | RESET_CLIP)) + g_assert_not_reached (); + + if (!add_offscreen_ops (self, builder, + &node->bounds, + top_child, + &top_region, &is_offscreen2, + FORCE_OFFSCREEN | RESET_CLIP)) + g_assert_not_reached (); ops_set_program (builder, &self->blend_program); ops_set_texture (builder, bottom_region.texture_id); @@ -2068,11 +2077,12 @@ render_repeat_node (GskGLRenderer *self, } /* Draw the entire child on a texture */ - g_assert (add_offscreen_ops (self, builder, - &child->bounds, - child, - ®ion, &is_offscreen, - RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN)); + if (!add_offscreen_ops (self, builder, + &child->bounds, + child, + ®ion, &is_offscreen, + RESET_CLIP | RESET_OPACITY | FORCE_OFFSCREEN)) + g_assert_not_reached (); ops_set_program (builder, &self->repeat_program); ops_set_texture (builder, region.texture_id); -- 2.30.2